package com.oocl.scpSSH;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

import com.oocl.controller.Controller;

public class Entry {
	
	private static Controller cp;
	
	public static void main(String[] args) throws IOException {
		init();
		ServerSocket server = new ServerSocket(7777);
		
		while(true){
			
			Socket socket = server.accept();
//			System.out.println("start...");
			InputStream in = socket.getInputStream();
			OutputStream out = socket.getOutputStream();
			cp = new Controller(in, out);
			out.write("scpSSH:\r\n".getBytes());
			out.write("Input Command:\r\n".getBytes());
			cp.process();
		}
	}
	
	public static void init() throws IOException{
		File[] f = new File[5];
		for (int i = 0; i < 5; i++) {
			f[i] = new File("D:\\scpSSh\\readme"+i+".txt");
			if(!f[i].exists()){
				f[i].createNewFile();
			}
		}
	}
}
